home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8625 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.1 KB

  1. Path: cypher.3do.com!user
  2. From: tsw@3do.com (Tom Watson)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2
  4. Subject: Number representation (was: Hungarian notation - whoops!)
  5. Date: Wed, 14 Feb 1996 19:20:17 -0800
  6. Organization: The 3DO Corporation
  7. Distribution: world
  8. Message-ID: <tsw-1402961920170001@cypher.3do.com>
  9. References: <30C40F77.53B5@swsbbs.com> <Pine.HPP.3.91.960124153551.24374C-100000@zeezrom.cs.byu.edu> <4e7ifl$et3@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960129133429.8419C-100000@foggy.cs.byu.edu> <4em29qINN39r@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960201015336.17360C-100000@clear.cs.byu.edu> <4f41vf$g8j@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960205124102.18647E-100000@warm.cs.byu.edu> <4fc157$jsf@goanna.cs.rmit.EDU.AU> <dewar.823793746@schonberg> <4fms62$c0p@goanna.cs.rmit.EDU.AU>
  10. NNTP-Posting-Host: cypher.3do.com
  11.  
  12. In article <4fms62$c0p@goanna.cs.rmit.EDU.AU>, ok@goanna.cs.rmit.EDU.AU
  13. (Richard A. O'Keefe) wrote:
  14.  
  15. > >By the way, S&M is of course the right representation of floating-point,
  16. > >using 2's complement for floating-point is a goof that only a designer
  17. > >not understanding fpt would make!
  18.  
  19. I'm not so sure.  With sign & magnitude you get TWO representations of the
  20. same number (zero).  Some may argue that the difference is that negative
  21. zero is what a very small negative number decays into, and positive zero
  22. is what a very small positive number decays into.  My understanding of
  23. numbers (no, I'm not an expert at this!) is that zero is only ONE number
  24. (basically without sign).  Most numbering systems (like two's complement
  25. integers) have put in the positive domain.
  26.  
  27. I have worked on a computer that had its floating point numbers in two's
  28. complement form.  It was a definition of convience (a negative number is
  29. represented as the two's complement of its corresponding postitve
  30. number).  This definition (coupled with the fact that both floating point
  31. and fixed point used the same set of registers) allowed quite a few
  32. instructions to overlap (an instruction "load complement word" worked for
  33. either).
  34.  
  35. The machine (obviously) was pre IEEE floating point numbers, but worked
  36. VERY well.  All that was needed to be implemented were 8 (count 'em)
  37. floating point instructions (+, -, *, / in double & single).  If a result
  38. underflowed (which raised an optional trap) the result decayed to zero,
  39. which usually gave proper results.  Programs didn't need to test for
  40. multiple incantations of zero (which needs to be done with IEEE numbers if
  41. the hardware doesn't detect BOTH forms).
  42.  
  43. As far as I can see, the only good thing (tm) that multiple (+ & -) zeros
  44. gets you is multiple infinities when you divide by it (which may be the
  45. object).  As long as both positive and negative numbers exist, and there
  46. is SOME method of making a bit pattern happen for each of them that are
  47. defined, it probably doesn't mean much which bits are turned on (use gray
  48. code, I don't care).  Just make sure that all the operations necessary are
  49. working, and give proper (documented) results.
  50.  
  51. [boy am I going to get flamed for this......]
  52.  
  53. -- 
  54. Tom Watson
  55. tsw@3do.com         (Home: tsw@johana.com)
  56.